package com.jewaton.auth.commons.service;

import com.jewaton.auth.commons.entity.Account;
import com.jewaton.auth.commons.entity.District;
import com.jewaton.auth.commons.entity.Organization;
import com.jewaton.auth.commons.util.Pager;
import org.apache.shiro.subject.PrincipalCollection;

import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface AccountService {

	public void addAccount(Account account);
	
	public void updateAccount(Account account);
	
	public Account getAccountById(Long id);
	
	public Pager<Account> getPcAccountPage(int pageNo, int pageSize, String oid, String userName);
	
	public void deleteAccount(long aid);
	
	public Account getAccountByName(String username);
	
	public List<Map<String, Object>> getAccountListByName(String name);
	
	public Account getAccountByEmail(String email);
	
	public List<Organization> getOrgByDid(String did);

	public List<District> getFuzzyDistrictByDid(String did);

	/**
	 * 当前组织所包括的所有下属机构
	 * @param oid
	 * @param area 不为空且登陆者orgid=001  则查询结果不包括001
	 * @return
	 */
	public List<Organization> getFuzzyOrgByOid(String oid,String area);

	/**
	 * 当前组织树
	 * @param oid
	 * @return
	 */
	public List<Map<String, Object>> getOrgTreeByOid(String oid);
	
	public void deleteManyAccount(String aidArray);

    public void clearCachedAuthorizationInfoOnSessionExpiration(PrincipalCollection principal);
    
    public Pager<Account> getAidListConfig(Map<String, Object>map,int pageNo,int pageSize);
    
    /**
     * @param oid 组织机构编码
     * @param name 登录名 或者 姓名
     * @return
     */
    public Pager<Account> searchAccount(String oid, String name, int pageNo, int pageSize);
    
    
    public Pager<Account> getSameOrgAccount(String keyword, Long oldAid, Long aid, int pageNo, int pageSize);

	/**
	 * 当前登录用户的权限列表
	 * @return
	 */
	public Collection<String> getPermission();
	
	/**
	 * 查询所有用户
	 */
	public List<Account> getAll();
}
